-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add timezone and datetime formatting on workspace member level #5699
base: main
Are you sure you want to change the base?
add timezone and datetime formatting on workspace member level #5699
Conversation
TODOs/FIXMEs:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
- Added timezone and datetime formatting fields to
WorkspaceMember
type in GraphQL - Introduced
DateTimeSettings
component for user-specific datetime preferences - Refactored and moved timezone and datetime utilities to
workspace-member
module - Deleted redundant components and constants related to datetime settings
- Updated mock data to include new timezone and datetime formatting properties
packages/twenty-front/src/modules/settings/profile/components/DateTimeSettings.tsx
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/workspace-member/utils/detectTimeFormat.ts
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/workspace-member/utils/formatDateLabel.ts
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/workspace-member/utils/formatTimeLabel.ts
Outdated
Show resolved
Hide resolved
...ty-server/src/modules/workspace-member/standard-objects/workspace-member.workspace-entity.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, added some first comments, think we should use enums for workspace-member entity as you suggest, also we would like to create a graphql type to be able to use those enum values in the front
packages/twenty-front/src/modules/workspace-member/utils/formatDateLabel.ts
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/workspace-member/utils/formatDateLabel.ts
Outdated
Show resolved
Hide resolved
...ty-server/src/modules/workspace-member/standard-objects/workspace-member.workspace-entity.ts
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/user/dtos/workspace-member.dto.ts
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/workspace-member/constants/TimeFormat.ts
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/workspace-member/constants/TimeFormat.ts
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/workspace-member/constants/DateFormat.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
(updates since last review)
- Introduced timezone and datetime formatting at the workspace member level
- Updated GraphQL queries and mutations to use new
DateFormat
andTimeFormat
enums - Enhanced
DateTimeSettings.tsx
for granular control over date and time settings - Added new fields and enums for timeZone, dateFormat, and timeFormat in
workspace-member.dto.ts
- Updated
workspace-member.workspace-entity.ts
to define and use new enums for date and time formats
@@ -34,7 +34,7 @@ export const Elipsis: Story = { | |||
|
|||
export const Performance = getProfilingStory({ | |||
componentName: 'DateTimeFieldDisplay', | |||
averageThresholdInMs: 0.1, | |||
averageThresholdInMs: 0.2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: check - if we merge like this we need to be sure there isn't a better solution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is okay to increase if we don't have the choice but in that case you have to "proof" that you've understood the reason why it was increasing and why we can't do any better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Memoizing the function outside of react scope did the job! Now its running under 0.1ms 👍
packages/twenty-front/src/modules/settings/profile/components/DateTimeSettings.tsx
Outdated
Show resolved
Hide resolved
...ty-server/src/modules/workspace-member/standard-objects/workspace-member.workspace-entity.ts
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/settings/profile/components/DateTimeSettings.tsx
Outdated
Show resolved
Hide resolved
setTimeZone, | ||
TimeFormat.STANDARD, | ||
)})`, | ||
value: TimeFormat.STANDARD, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come 12 hours is "standard" 😁. We use 24hours in France ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha, I agree the naming is a little confusing here, its the "format" for time here which is "standard" if that makes sense. Whichever timezone is detected it will set it automatically to that "format" for that respective timezone
packages/twenty-front/src/modules/workspace-member/utils/formatDateLabel.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! Almost there :)
const handleSettingsChange = ( | ||
settingName: 'timeZone' | 'dateFormat' | 'timeFormat', | ||
value: string, | ||
) => { | ||
const workspaceMember: any = {}; | ||
const dateTime: any = {}; | ||
|
||
switch (settingName) { | ||
case 'timeZone': { | ||
workspaceMember[settingName] = value; | ||
dateTime[settingName] = value === 'system' ? detectTimeZone() : value; | ||
break; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried something different here to call setDateTimeFormat
once, open for suggestions :)
closes: #5140